package com.px.auth.service;

import com.px.auth.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Random;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    @Transactional
    public void tran(){
        userMapper.insert(10.2);
        if (new Random().nextInt(10) > 0)
            throw new RuntimeException();
        userMapper.insert(11.2);
    }
}
